import Taro, {Component} from '@tarojs/taro'
import {View, Text} from '@tarojs/components'
import {connect} from '@tarojs/redux'
import './home.less'
import UserMsg from '../../components/userMsg/userMsg.jsx';
import MyGrid from '../../components/myGrid/myGrid.jsx';
import {
  UserActive,
  AssetsInfo,
  BrowsingInfo,
  UserToolsGroup
} from '../../common/home/options';


@connect(({home}) => ({
  home,
}))
class Home extends Component {
  config = {
    navigationBarTitleText: '我的'
  }

  constructor(props) {
    super(props)
    this.state = {}
  }

  getList() {
    const params = {
      pageNo: 2,
    }
    this.props.dispatch({
      type: 'home/getList',
      payload: params
    }).then(() => {
      console.log('-=-=-=', this.props)
    })
    console.log('-=-await=-=', this.props)
  }

  componentWillMount() {

    // this.getList()

  }

  componentDidMount() {
  }

  componentWillUnmount() {
  }

  componentDidShow() {
  }

  componentDidHide() {
  }

  render() {
    const {data} = this.props.home

    return (
      <View className='fx-home-wrap'>

        <UserMsg/>
        <MyGrid dataSource={UserActive}/>
        <MyGrid dataSource={AssetsInfo}/>
        <MyGrid dataSource={BrowsingInfo}/>
        <MyGrid dataSource={UserToolsGroup} col='at-col-3'/>

      </View>
    )
  }
}

export default Home
